<template>
	<view >
		<uni-card title="新增投诉">
			<u-field label="公司名称:" v-model="companyName"></u-field>
			<u-field label="运单号:" v-model="infoNo"></u-field>
			<u-field label="投诉内容" type="textarea" placeholder="请填写" v-model="value"></u-field>
		</uni-card>
		<u-dropdown ref="dropdown">
			<u-dropdown-item @change="getvaluee" :title="'投诉类型:'+leixing" :options="list"></u-dropdown-item>
		</u-dropdown>
		
		<view class="" style="height: 20vh;"></view>
		<view style="position: absolute;bottom: 0%;right:0%;left: 0%;padding: 20rpx;">
			<button type="primary" @click="CD">投诉</button>
		</view>
	</view>
</template>

<script>
	import api from 'commer/apiURL.js'
	export default {
		data() {
			return {
				base:api.baseurl,
				companyId:'',
				infoNo:'',
				companyName:'',
				value:'',
				listID:'',
				leixing:'快递丢失',
				list:[
					{
						label:"快递丢失",
						value:1,
						
					},
					{
						label:"快递破损",
						value:2,
					},
					{
						label:"快递被拆封",
						value:3,
					},
					{
						label:"工作人员态度恶劣",
						value:4,
					},
					{
						label:"未送货上门",
						value:5,
					}
				]
			}
		},
		onLoad(){
			this.getcd()
			this.getxin()
		},
		methods: {
			getvaluee(e){
				console.log(e)
				this.listID = e
			},
			CD(){
				if(this.companyId == '' | this.infoNo == ''| this.value == ''){
					uni.showToast({
						title:'不能为空',
						icon:'none'
					})
					return
				}
				this.$post(this.base+'/prod-api/api/logistics-inquiry/logistics_complaint',{
					"companyId": this.companyId,
					"infoNo": this.infoNo,
					"questionType": this.listID,
					"description": this.value
				}).then((res)=>{
					console.log(res)
					uni.navigateBack({
						
					})
				})
			},
			getcd(){
				this.infoNo = uni.getStorageSync('dc')
			},
			getxin(){
				this.$get(this.base + '/prod-api/api/logistics-inquiry/logistics_info/' + this.infoNo).then((res) => {
					if (res.code == 200) {
						this.companyId = res.data.companyId
						this.companyName = res.data.company.name
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			}
			
		}
	}
</script>

<style>

</style>
